package com.dragon.sdgp.controller;

import com.dragon.sdgp.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @AUTHOR : Dragon_Yang
 * @File : DefaultWordsController
 * @DESCRIPTION :
 * @DATE : 2023/2/28 11:11
 */
public class DefaultWordsController {

//    private static ConcurrentHashMap<String, Task> map = new ConcurrentHashMap<>();

//    @Autowired
//    DefaultWordsService defaultWordsService;

//    @GetMapping("/test1")
//    public Object test1(HttpServletResponse httpServletResponse, HttpServletRequest httpServletRequest) throws InterruptedException {
//        Task task = new Task(999, Thread.currentThread());
//        map.put(Thread.currentThread().getName(), task);
//        try {
//            DefaultDataGenerateUtil.threadPoolExecutor.submit(task);
//        }catch (Exception e){
//            httpServletResponse.setStatus(400);
//            System.out.println("=>" + httpServletResponse.getStatus());
//            return "服务繁忙";
//        }
//        synchronized (Thread.currentThread()){
//            Thread.currentThread().wait(0);
//        }
//        System.out.println(Thread.currentThread().getName() + "=>" + httpServletResponse.getStatus());
//        return map.get(Thread.currentThread().getName()).res;
//    }
//
//    @GetMapping("/test2")
//    public Object test2(){
//        return defaultWordsService.getValueByOrderRandNoRepeat("person_name", CommonUtil.getRandom(0), 30000);
//    }
}
//
//class Task implements Runnable{
//    int n;
//    Thread thread = null;
//    ArrayList<String> res;
//    public Task(int n, Thread thread){
//        this.n = n;
//        this.thread = thread;
//    }
//
//    @Override
//    public void run() {
//        res = DefaultDataGenerateUtil.createPersonNameList(n);
//        synchronized (thread){
//            thread.notify();
//        }
//    }
//}